<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>国省自检--${fns:getConfig('productName')}</title>
<link rel="stylesheet" href="${ctx}/styles/gsjcss/common.css">
<script type="text/javascript">
    function btnClick(){
        var url = '${ctx}/ruleManager/search.do?projectId=${fns:encodeParamUrl(projectId)}&menuId=${fns:encodeParamUrl(menuId)}';
        var data = {};
       	data['retrieval'] = getJson('condition');
           loadData(url,data);
        }
    //ajax执行成功之后的回调方法
    function loadDataToTable(data){
    	var attData = data['att'];
    	var score = data['score'];
        var percent = data['percent'];
        var manageData  = data['manageData'];
        var scoreLists = data['scoreLists'];
        //检索附件的回调方法
        loadAttachment(attData);
        //检索文件的回调方法
        for(var j = 0; j<manageData.length;j++ ){
            loadAttachment(manageData[j].attachments);
        }
        //当flag为true时，说明进行了检索并返回来结果
        if(data['flag']){
        	var tr ="";
        	var content = '<table style="width:98%;text-align:center;margin-top:5px;font-family:verdana;color:black" border="1" ><thead><tr style="height:45px">'+
					        	'<th style="width:25px">序号</th>'+
					            '<th style="width:50px">地方（区县）</th>'+
					            '<th style="width:37px">工程项目</th>'+
					            '<th style="width:37px">计 划（有/无）</th>'+
					            '<th style="width:44px">设计审查（有/无）</th>'+
					            '<th style="width:37px">招投标（是/否）</th>'+
					            '<th style="width:56px">工程质量监督（有/无）</th>'+
					            '<th style="width:77px">交（竣）工报告齐全（是/否）</th>'+
					            '<th style="width:77px">质量是否符合工程验收标准（有/无）</th>'+
					            '<th style="width:77px">工程变更台账是否齐全，造价变更管理是否合规（是/否）</th>'+
					            '<th style="width:45px">检查得分</th>'+
					            '<th style="width:45px">检查总分</th>'+
					            '<th style="width:36px">完善度</th></tr></thead><tbody>';
            for(var i = 0; i<manageData.length; i++){
                tr += '<tr><td>'+(i+1)+'</td><td>'+manageData[i].location+'</td><td>'+manageData[i].itemName+'</td>';
                if(manageData[i].planing == "1"){
                    tr += "<td>"+imgRight+"</td>";
                } else {
                    tr +="<td>"+imgError+"</td>";
                }
                if(manageData[i].design == 1){
                    tr +="<td>"+imgRight+"</td>";
                } else {
                    tr +="<td>"+imgError+"</td>";
                }
                if(manageData[i].bidding == 1){
                    tr +="<td>"+imgRight+"</td>";
                } else {
                    tr +="<td>"+imgError+"</td>";
                }
                if(manageData[i].projectQuality == 1){
                    tr +="<td>"+imgRight+"</td>";
                } else {
                    tr +="<td>"+imgError+"</td>";
                }
                if(manageData[i].workReport == 1){
                    tr +="<td>"+imgRight+"</td>";
                } else {
                    tr +="<td>"+imgError+"</td>";
                }
                if(manageData[i].acceptanceStandard == 1){
                    tr +="<td>"+imgRight+"</td>";
                } else {
                    tr +="<td>"+imgError+"</td>";
                }
                if(manageData[i].changeRule == 1){
                    tr +="<td>"+imgRight+"</td>";
                } else {
                    tr +="<td>"+imgError+"</td>";
                }
                tr += '<td>'+scoreLists[i]+'</td>';
                if (i == 0){
                	tr += '<td class="sumTd" rowspan="'+manageData.length+'">'+score+'</td>';
                	tr += '<td class="perTd" rowspan="'+(manageData.length)+'">'+percent+'%</td>';
                }
            }
           		content += tr+'</tr></tbody></table>';
            $('#checkResult').append(content);
        }
    }
</script>
</head>
<body>
	<div id="x_top"></div>
	<tags:message content="${msg}" />
	<c:if test="${not empty checkTable.id}">
		<div style="text-align:center">
			<a href="javascript:void(0);" class="btn btn-primary" onclick="downWord('${ctx}/ruleManager/downWord.do?projectId=${fns:encodeParamUrl(projectId)}&menuId=${fns:encodeParamUrl(menuId)}');" id= "btnDown" role="button" ><div id="x_v"></div></a>
		</div>
	</c:if>
    <form id="checkForm" class="form-horizontal"  method="POST"  name="checkForm" action="${ctx}/ruleManager/save.do?left=${fns:encodeParam(left)}&top=${fns:encodeParam(top)}&projectId=${fns:encodeParam(projectId)}&menuId=${fns:encodeParam(menuId)}&leftChild=${fns:encodeParam(leftChild)}">
        <input type="hidden" name="token" value="${token}">
        <div id="show">
            <div id="showTable" class="showTable">
                <jsp:include page="/WEB-INF/views/check/common.jsp"/> 
                <div class="model">
                    <div>
                    	<legend>三、检查条件及设置</legend>
                        <div class="content-title" id="condition">
                       		<div style="float:left;margin-right:10px;">
                            	<div>
	                        		<span>选择工程<font style="color:red;">*</font>：</span>
									<tags:treeselect id="office" name="itemProjectId" value="" labelName="objectName" labelValue=""
										title="单位" url="/ruleManager/ruleMageData.do?projectId=${projectId}" allowClear="true" checked ="true"/>
                            	</div>
	                        	<div style="margin-top: 15px;">
		                           	<span>每个项目满分<font style="color:red;">*</font>：</span>
		                           		<input type="text" name="yearFull" id="yearFull"  maxlength="6" class="required conInput" value='4'>
		                           	<span style="margin-left:30px">每发现一个问题扣分<font style="color:red;">*</font>：</span>
		                           		<input type="text" name="yearPart" id="yearPart"  maxlength="6" class="required conInput" value='1'>
	                        	</div>
                            </div>
	                        <div id="x_s" style="float:right">
								<div class="x_ico"></div>
								<a href="#javascript:void(0)" onclick= "btnClick();"  id= "btnSearch" role="button" >搜索&nbsp;</a>
							</div>
                        </div>
                    </div>
                </div>
                <div class="model">
                    <div>
                    	<legend>四、检索结果</legend>
                        <div class="content-title">
                            <div class="tabbox">
                                <div class="tab">
                                <a href="javascript:;" class="on">规章制度</a>
                                    <c:forEach items="${childMenuList}" var="menu"  varStatus="idxStatus">
                                        <c:if test="${idxStatus.index >= 2}">
                                            <a href="javascript:;">${menu.name}</a>
                                        </c:if>
                                    </c:forEach>
                                </div>
                                <div class="content">
                                    <ul>
                                        <c:forEach items="${childMenuList}" var="menu" varStatus="idxStatus">
                                            <c:if test="${idxStatus.index >= 1}">
                                                <li>
                                                    <table style="width:98%;text-align:center;margin-top:5px;" border="1" id="${menu.tag}">
                                                        <thead>
                                                            <th>序号</th>
                                                            <th>操作</th>
                                                            <th>发文单位</th>
                                                            <th>上传用户</th>
                                                            <th>文件名</th>
                                                            <th>发文日期</th>
                                                            <th>上传日期</th>
                                                            <th>文件大小</th>
                                                            <th>文件类型</th>
                                                        </thead>
                                                        <tbody>
                                                            
                                                        </tbody>
                                                    </table>
                                                </li>
                                            </c:if>
                                        </c:forEach>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="model">
                    <div>
                    	<legend>五、检查评分</legend>
                        <div class="context-title" id="checkResult">
                        
                        </div>
                    </div>
                </div>
                <div class="model">
                    <div class="content-btn">
                        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="toBack()" />
                    </div>
                </div>
            </div>
        </div>
    </form>
    <script src="${ctxStatic}/js/check/checkCommon.js" type="text/javascript"></script>
</body>
</html>